package com.yhsimon.mapper;

import com.yhsimon.pojo.User;
import org.mybatis.spring.support.SqlSessionDaoSupport;

import java.util.List;

public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper {


    @Override
    public List<User> selectUsers() {
        User user = new User("YH", "123");
        addUser(user);
        deleteUser(user.getId());
        return getSqlSession().getMapper(UserMapper.class).selectUsers();
    }

    @Override
    public void addUser(User user) {
        getSqlSession().getMapper(UserMapper.class).addUser(user);
    }

    @Override
    public void deleteUser(int id) {
        getSqlSession().getMapper(UserMapper.class).deleteUser(id);
    }
}
